package sharding.controller;

import cn.hutool.core.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import sharding.entity.HssHistoryEntity;
import sharding.service.HssHistoryService;

import java.util.Date;

@RestController
public class ShardingController {
    @Autowired
    private HssHistoryService hssHistoryService;

    @GetMapping("/sharding")
    public String getData() {
        HssHistoryEntity entity = new HssHistoryEntity();
        entity.setEquipmentId(124L);
        entity.setData("{\"s\":1}");
        entity.setParseData("{\"s\":1}");
        entity.setCreateTime(DateUtil.offsetMonth(new Date(), 1));
        entity.setTypeId(5L);
        entity.setParseTime(111L);
        hssHistoryService.save(entity);
        return "成功";
    }
}
